<template>
	<view class="page my_doctor_page">
		<patient @info="getPatientId"></patient>
		<view class="doctor_list" v-if="list.length>0">
			<view class="card doctor_item" v-for="item in list" :key="item.id">
				<doctorInfo :item="{
					name:item.name,
					titleName:item.titleName,
					departName:item.departName,
					levelName:item.levelName,
					hospitalName:item.hospitalName
				}"></doctorInfo>
				<view class="doctor_total">
					<view class="total_item">
						<text class="text">
							问诊次数
						</text>
						<text class="total">
							{{item.myOutpatientCount || 0}}次
						</text>
					</view>
					<view class="total_item">
						<text class="text">
							预约次数
						</text>
						<text class="total">
							{{item.myAppointCount || 0}}次
						</text>
					</view>
				</view>
				<view class="doctor_capacity ellipsis-2">
					<text class="text">擅长:</text>
					{{item.proficient || ''}}
				</view>
			</view>
		</view>
		<view class="no_thing" v-else>
			<image class="placeholder" src="@/static/images/noting.png" mode="scaleToFill"></image>
		</view>
	</view>
</template>

<script>
	import {
		getMyDoctorInfoList
	} from '@/api/index.js'
	export default {
		data() {
			return {
				list: [],
				total: 0,
				queryForm: {
					patientId: 0
				}
			}
		},
		onLoad() {},
		methods: {
			getPatientId(value) {
				this.queryForm.id = value.id
				this.getMyDoctorInfoList()
			},
			getMyDoctorInfoList() {
				getMyDoctorInfoList(this.queryForm).then(res => {
					this.list = res.data
					this.total = res.total
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.my_doctor_page {

		.doctor_list {
			.doctor_item {
				margin-top: 30rpx;
				padding: 30rpx 20rpx;

				.doctor_total {
					display: flex;
					align-items: center;
					margin-bottom: 30rpx;

					.total_item {
						position: relative;
						margin-right: 50rpx;
						font-weight: 500;
						font-size: 22rpx;
						color: rgba(153, 153, 153, 0.8);

						&:not(:last-child)::after {
							content: '';
							position: absolute;
							transform: translate(-50%, -50%);
							top: 50%;
							right: -25rpx;
							width: 1px;
							height: 80%;
							background-color: #EEEEEE;
						}

						.total {
							display: inline-block;
							margin-left: 10rpx;
							font-weight: bold;
							font-size: 26rpx;
							color: #333;
						}
					}
				}

				.doctor_capacity {
					color: #333;
					font-size: 26rpx;

					.text {
						display: inline-block;
						color: #999999;
						margin-right: 10rpx;
					}
				}
			}
		}
	}
</style>